cd D:\Dropbox\book_welfare\


use 	 "data\pennames_from_trussel_new.dta", clear  
		 	

			split penname, parse(" ")
			
						
						
			gen name=upper(penname1)
			merge m:1 name usingname_gender_wipo.dta

			drop if _merge==2 
			
			gen real_gender =  "male" if rmshare>.5 & rmshare~=. 
			replace  real_gender =  "female" if rmshare<=.5 & rmshare~=. 
			replace  real_gender =  "unknown" if   rmshare==. 
			
			
			gen name_gender =  "male" if mshare>.5 & mshare~=. 
			replace  name_gender =  "female" if mshare<=.5 & mshare~=. 
			replace  name_gender =  "unknown" if   mshare==. 
			
			
			distinct name if byear~=.			
			tab2  real_gender  name_gender  , row
			tab2  real_gender  name_gender if byear>1000 & byear<1875 & byear~=. , row
			tab2  real_gender  name_gender if byear>=1875 & byear<1925 & byear~=. , row
			tab2  real_gender  name_gender if byear>=1925 & byear~=. , row

			tab2  real_gender  name_gender if  byear<1925 & byear~=. , row
			tab2  real_gender  name_gender if byear>=1925 & byear~=. , row
			